package com.campus_information_portal.dao;

import com.campus_information_portal.entity.Term;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * @author 20155872 游宇
 * @className TermDao
 * @Description 学年学期dao
 * @create 2018-05-10 10:54
 **/
public interface TermDao {


    /**
     * @Description: 查询所有的学年学期记录
     * @author: 20155872 游宇
     * @methodName: getAllTerm
     * @param: null
     * @returnType: List<Term>
     * @createTime: 2018/5/17 10:23
     **/
    @Select("select * from term")
    List<Term> getAllTerm();

    /**
     * @Description: 添加一条记录到term表中
     * @author: 20155872 游宇
     * @methodName: addTerm
     * @param: Term term
     * @returnType: boolean
     * @createTime: 2018/5/17 10:24
     **/
    @Insert("insert into term(term_year,term_num) values(#{termYear},#{termNum})")
    boolean addTerm(Term term);

    /**
     * @param termYear,termNum
     * @Description 根据学年以及学期查询term_id
     * @author 20155870 杨润增
     * @methodName queryTermId
     * @returnType int
     * @create 2018/5/18 16:04
     **/
    @Select("select * from Term where term_year=#{termYear} and term_num=#{termNum}")
    Term queryTermId(@Param("termYear") String termYear, @Param("termNum") String termNum);
}
